class Solution {
public:
    int singleNumber(vector<int>& nums) {
        unordered_map<int, int> ump;
        for (auto x : nums) ump[x]++;
        for (auto x : nums) {
            if (ump[x] == 1) return x;
        }
        return 0;
    }
};
